home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / FLEX-TC_ / FLEX.MAN < prev    next >
Text File  |  1990-02-10  |  26KB  |  727 lines

  1.  
  2.  
  3.  
  4. FLEX(1)             UNIX Programmer's Manual              FLEX(1)
  5.  
  6.  
  7.  
  8. NAME
  9.      flex - fast lexical analyzer generator
  10.  
  11. SYNOPSIS
  12.      flex [ -bdfipstvFILT -c[efmF] -Sskeleton_file ] [ _f_i_l_e_n_a_m_e ]
  13.  
  14. DESCRIPTION
  15.      _f_l_e_x is a rewrite of _l_e_x intended to right some of that
  16.      tool's deficiencies: in particular, _f_l_e_x generates lexical
  17.      analyzers much faster, and the analyzers use smaller tables
  18.      and run faster.
  19.  
  20. OPTIONS
  21.      In addition to lex's -t flag, flex has the following
  22.      options:
  23.  
  24.      -b   Generate backtracking information to _l_e_x._b_a_c_k_t_r_a_c_k.
  25.           This is a list of scanner states which require back-
  26.           tracking and the input characters on which they do so.
  27.           By adding rules one can remove backtracking states.  If
  28.           all backtracking states are eliminated and -f or -F is
  29.           used, the generated scanner will run faster (see the -p
  30.           flag).  Only users who wish to squeeze every last cycle
  31.           out of their scanners need worry about this option.
  32.  
  33.      -d   makes the generated scanner run in _d_e_b_u_g mode.  When-
  34.           ever a pattern is recognized the scanner will write to
  35.           _s_t_d_e_r_r a line of the form:
  36.  
  37.               --accepting rule #n
  38.  
  39.           Rules are numbered sequentially with the first one
  40.           being 1.  Rule #0 is executed when the scanner back-
  41.           tracks; Rule #(n+1) (where _n is the number of rules)
  42.           indicates the default action; Rule #(n+2) indicates
  43.           that the input buffer is empty and needs to be refilled
  44.           and then the scan restarted.  Rules beyond (n+2) are
  45.           end-of-file actions.
  46.  
  47.      -f   has the same effect as lex's -f flag (do not compress
  48.           the scanner tables); the mnemonic changes from _f_a_s_t
  49.           _c_o_m_p_i_l_a_t_i_o_n to (take your pick) _f_u_l_l _t_a_b_l_e or _f_a_s_t
  50.           _s_c_a_n_n_e_r. The actual compilation takes _l_o_n_g_e_r, since
  51.           flex is I/O bound writing out the big table.
  52.  
  53.           This option is equivalent to -cf (see below).
  54.  
  55.      -i   instructs flex to generate a _c_a_s_e-_i_n_s_e_n_s_i_t_i_v_e scanner.
  56.           The case of letters given in the flex input patterns
  57.           will be ignored, and the rules will be matched regard-
  58.           less of case.  The matched text given in _y_y_t_e_x_t will
  59.           have the preserved case (i.e., it will not be folded).
  60.  
  61.  
  62.  
  63. Printed 2/10/90           20 June 1989                          1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. FLEX(1)             UNIX Programmer's Manual              FLEX(1)
  71.  
  72.  
  73.  
  74.      -p   generates a performance report to stderr.  The report
  75.           consists of comments regarding features of the flex
  76.           input file which will cause a loss of performance in
  77.           the resulting scanner.  Note that the use of _R_E_J_E_C_T and
  78.           variable trailing context (see BUGS) entails a substan-
  79.           tial performance penalty; use of _y_y_m_o_r_e(), the ^ opera-
  80.           tor, and the -I flag entail minor performance penal-
  81.           ties.
  82.  
  83.      -s   causes the _d_e_f_a_u_l_t _r_u_l_e (that unmatched scanner input
  84.           is echoed to _s_t_d_o_u_t) to be suppressed.  If the scanner
  85.           encounters input that does not match any of its rules,
  86.           it aborts with an error.  This option is useful for
  87.           finding holes in a scanner's rule set.
  88.  
  89.      -v   has the same meaning as for lex (print to _s_t_d_e_r_r a sum-
  90.           mary of statistics of the generated scanner).  Many
  91.           more statistics are printed, though, and the summary
  92.           spans several lines.  Most of the statistics are mean-
  93.           ingless to the casual flex user, but the first line
  94.           identifies the version of flex, which is useful for
  95.           figuring out where you stand with respect to patches
  96.           and new releases.
  97.  
  98.      -F   specifies that the _f_a_s_t scanner table representation
  99.           should be used.  This representation is about as fast
  100.           as the full table representation (-_f), and for some
  101.           sets of patterns will be considerably smaller (and for
  102.           others, larger).  In general, if the pattern set con-
  103.           tains both "keywords" and a catch-all, "identifier"
  104.           rule, such as in the set:
  105.  
  106.                "case"    return ( TOK_CASE );
  107.                "switch"  return ( TOK_SWITCH );
  108.                ...
  109.                "default" return ( TOK_DEFAULT );
  110.                [a-z]+    return ( TOK_ID );
  111.  
  112.           then you're better off using the full table representa-
  113.           tion.  If only the "identifier" rule is present and you
  114.           then use a hash table or some such to detect the key-
  115.           words, you're better off using -_F.
  116.  
  117.           This option is equivalent to -cF (see below).
  118.  
  119.      -I   instructs flex to generate an _i_n_t_e_r_a_c_t_i_v_e scanner.
  120.           Normally, scanners generated by flex always look ahead
  121.           one character before deciding that a rule has been
  122.           matched.  At the cost of some scanning overhead, flex
  123.           will generate a scanner which only looks ahead when
  124.           needed.  Such scanners are called _i_n_t_e_r_a_c_t_i_v_e because
  125.           if you want to write a scanner for an interactive
  126.  
  127.  
  128.  
  129. Printed 2/10/90           20 June 1989                          2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. FLEX(1)             UNIX Programmer's Manual              FLEX(1)
  137.  
  138.  
  139.  
  140.           system such as a command shell, you will probably want
  141.           the user's input to be terminated with a newline, and
  142.           without -I the user will have to type a character in
  143.           addition to the newline in order to have the newline
  144.           recognized.  This leads to dreadful interactive perfor-
  145.           mance.
  146.  
  147.           If all this seems to confusing, here's the general
  148.           rule: if a human will be typing in input to your
  149.           scanner, use -I, otherwise don't; if you don't care
  150.           about how fast your scanners run and don't want to make
  151.           any assumptions about the input to your scanner, always
  152.           use -I.
  153.  
  154.           Note, -I cannot be used in conjunction with _f_u_l_l or
  155.           _f_a_s_t _t_a_b_l_e_s, i.e., the -f, -F, -cf, or -cF flags.
  156.  
  157.      -L   instructs flex to not generate #line directives (see
  158.           below).
  159.  
  160.      -T   makes flex run in _t_r_a_c_e mode.  It will generate a lot
  161.           of messages to stdout concerning the form of the input
  162.           and the resultant non-deterministic and deterministic
  163.           finite automatons.  This option is mostly for use in
  164.           maintaining flex.
  165.  
  166.      -c[efmF]
  167.           controls the degree of table compression.  -ce directs
  168.           flex to construct _e_q_u_i_v_a_l_e_n_c_e _c_l_a_s_s_e_s, i.e., sets of
  169.           characters which have identical lexical properties (for
  170.           example, if the only appearance of digits in the flex
  171.           input is in the character class "[0-9]" then the digits
  172.           '0', '1', ..., '9' will all be put in the same
  173.           equivalence class).  -cf specifies that the _f_u_l_l
  174.           scanner tables should be generated - flex should not
  175.           compress the tables by taking advantages of similar
  176.           transition functions for different states.  -cF speci-
  177.           fies that the alternate fast scanner representation
  178.           (described above under the -F flag) should be used.  -
  179.           cm directs flex to construct _m_e_t_a-_e_q_u_i_v_a_l_e_n_c_e _c_l_a_s_s_e_s,
  180.           which are sets of equivalence classes (or characters,
  181.           if equivalence classes are not being used) that are
  182.           commonly used together.  A lone -c specifies that the
  183.           scanner tables should be compressed but neither
  184.           equivalence classes nor meta-equivalence classes should
  185.           be used.
  186.  
  187.           The options -cf or -cF and -cm do not make sense
  188.           together - there is no opportunity for meta-equivalence
  189.           classes if the table is not being compressed.  Other-
  190.           wise the options may be freely mixed.
  191.  
  192.  
  193.  
  194.  
  195. Printed 2/10/90           20 June 1989                          3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. FLEX(1)             UNIX Programmer's Manual              FLEX(1)
  203.  
  204.  
  205.  
  206.           The default setting is -cem which specifies that flex
  207.           should generate equivalence classes and meta-
  208.           equivalence classes.  This setting provides the highest
  209.           degree of table compression.  You can trade off
  210.           faster-executing scanners at the cost of larger tables
  211.           with the following generally being true:
  212.  
  213.               slowest            smallest
  214.                          -cem
  215.                          -ce
  216.                          -cm
  217.                          -c
  218.                          -c{f,F}e
  219.                          -c{f,F}
  220.               fastest            largest
  221.  
  222.           Note that scanners with the smallest tables compile the
  223.           quickest, so during development you will usually want
  224.           to use the default, maximal compression.
  225.  
  226.      -Sskeleton_file
  227.           overrides the default skeleton file from which flex
  228.           constructs its scanners.  You'll never need this option
  229.           unless you are doing flex maintenance or development.
  230.  
  231. INCOMPATIBILITIES WITH LEX
  232.      _f_l_e_x is fully compatible with _l_e_x with the following excep-
  233.      tions:
  234.  
  235.      -    There is no run-time library to link with.  You needn't
  236.           specify -_l_l when linking, and you must supply a main
  237.           program.  (Hacker's note: since the lex library con-
  238.           tains a main() which simply calls yylex(), you actually
  239.           _c_a_n be lazy and not supply your own main program and
  240.           link with -_l_l.)
  241.  
  242.      -    lex's %r (Ratfor scanners) and %t (translation table)
  243.           options are not supported.
  244.  
  245.      -    The do-nothing -_n flag is not supported.
  246.  
  247.      -    When definitions are expanded, flex encloses them in
  248.           parentheses.  With lex, the following
  249.  
  250.               NAME    [A-Z][A-Z0-9]*
  251.               %%
  252.               foo{NAME}?      printf( "Found it\n" );
  253.               %%
  254.  
  255.           will not match the string "foo" because when the macro
  256.           is expanded the rule is equivalent to "foo[A-Z][A-Z0-
  257.           9]*?" and the precedence is such that the '?' is
  258.  
  259.  
  260.  
  261. Printed 2/10/90           20 June 1989                          4
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. FLEX(1)             UNIX Programmer's Manual              FLEX(1)
  269.  
  270.  
  271.  
  272.           associated with "[A-Z0-9]*".  With flex, the rule will
  273.           be expanded to "foo([A-z][A-Z0-9]*)?" and so the string
  274.           "foo" will match.  Note that because of this, the ^, $,
  275.           <s>, and / operators cannot be used in a definition.
  276.  
  277.      -    The undocumented lex-scanner internal variable yylineno
  278.           is not supported.
  279.  
  280.      -    The input() routine is not redefinable, though may be
  281.           called to read characters following whatever has been
  282.           matched by a rule.  If input() encounters an end-of-
  283.           file the normal yywrap() processing is done.  A
  284.           ``real'' end-of-file is returned as _E_O_F.
  285.  
  286.           Input can be controlled by redefining the YY_INPUT
  287.           macro.  YY_INPUT's calling sequence is
  288.           "YY_INPUT(buf,result,max_size)".  Its action is to
  289.           place up to max_size characters in the character buffer
  290.           "buf" and return in the integer variable "result"
  291.           either the number of characters read or the constant
  292.           YY_NULL (0 on Unix systems) systems) to indicate EOF.
  293.           The default YY_INPUT reads from the file-pointer "yyin"
  294.           (which is by default _s_t_d_i_n), so if you just want to
  295.           change the input file, you needn't redefine YY_INPUT -
  296.           just point yyin at the input file.
  297.  
  298.           A sample redefinition of YY_INPUT (in the first section
  299.           of the input file):
  300.  
  301.               %{
  302.               #undef YY_INPUT
  303.               #define YY_INPUT(buf,result,max_size) \
  304.                   result = (buf[0] = getchar()) == EOF ? YY_NULL : 1;
  305.               %}
  306.  
  307.           You also can add in things like counting keeping track
  308.           of the input line number this way; but don't expect
  309.           your scanner to go very fast.
  310.  
  311.      -    output() is not supported.  Output from the ECHO macro
  312.           is done to the file-pointer "yyout" (default _s_t_d_o_u_t).
  313.  
  314.      -    If you are providing your own yywrap() routine, you
  315.           must "#undef yywrap" first.
  316.  
  317.      -    To refer to yytext outside of your scanner source file,
  318.           use "extern char *yytext;" rather than "extern char
  319.           yytext[];".
  320.  
  321.      -    yyleng is a macro and not a variable, and hence cannot
  322.           be accessed outside of the scanner source file.
  323.  
  324.  
  325.  
  326.  
  327. Printed 2/10/90           20 June 1989                          5
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. FLEX(1)             UNIX Programmer's Manual              FLEX(1)
  335.  
  336.  
  337.  
  338.      -    flex reads only one input file, while lex's input is
  339.           made up of the concatenation of its input files.
  340.  
  341.      -    The name FLEX_SCANNER is #define'd so scanners may be
  342.           written for use with either flex or lex.
  343.  
  344.      -    The macro YY_USER_ACTION can be redefined to provide an
  345.           action which is always executed prior to the matched
  346.           rule's action.  For example, it could be #define'd to
  347.           call a routine to convert yytext to lower-case, or to
  348.           copy yyleng to a global variable to make it accessible
  349.           outside of the scanner source file.
  350.  
  351.      -    In the generated scanner, rules are separated using
  352.           YY_BREAK instead of simple "break"'s.  This allows, for
  353.           example, C++ users to #define YY_BREAK to do nothing
  354.           (while being very careful that every rule ends with a
  355.           "break" or a "return"!) to avoid suffering from
  356.           unreachable statement warnings where a rule's action
  357.           ends with "return".
  358.  
  359. ENHANCEMENTS
  360.      -    _E_x_c_l_u_s_i_v_e _s_t_a_r_t-_c_o_n_d_i_t_i_o_n_s can be declared by using %x
  361.           instead of %s. These start-conditions have the property
  362.           that when they are active, _n_o _o_t_h_e_r _r_u_l_e_s _a_r_e _a_c_t_i_v_e.
  363.           Thus a set of rules governed by the same exclusive
  364.           start condition describe a scanner which is independent
  365.           of any of the other rules in the flex input.  This
  366.           feature makes it easy to specify "mini-scanners" which
  367.           scan portions of the input that are syntactically dif-
  368.           ferent from the rest (e.g., comments).
  369.  
  370.      -    _y_y_t_e_r_m_i_n_a_t_e() can be used in lieu of a return statement
  371.           in an action.  It terminates the scanner and returns a
  372.           0 to the scanner's caller, indicating "all done".
  373.  
  374.      -    _E_n_d-_o_f-_f_i_l_e _r_u_l_e_s. The special rule "<<EOF>>" indicates
  375.           actions which are to be taken when an end-of-file is
  376.           encountered and yywrap() returns non-zero (i.e., indi-
  377.           cates no further files to process).  The action can
  378.           either point yyin at a new file to process, in which
  379.           case the action should finish with _Y_Y__N_E_W__F_I_L_E (this is
  380.           a branch, so subsequent code in the action won't be
  381.           executed), or it should finish with a _r_e_t_u_r_n statement.
  382.           <<EOF>> rules may not be used with other patterns; they
  383.           may only be qualified with a list of start conditions.
  384.           If an unqualified <<EOF>> rule is given, it applies
  385.           only to the INITIAL start condition, and _n_o_t to %s
  386.           start conditions.  These rules are useful for catching
  387.           things like unclosed comments.  An example:
  388.  
  389.               %x quote
  390.  
  391.  
  392.  
  393. Printed 2/10/90           20 June 1989                          6
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. FLEX(1)             UNIX Programmer's Manual              FLEX(1)
  401.  
  402.  
  403.  
  404.               %%
  405.               ...
  406.               <quote><<EOF>>   {
  407.                     error( "unterminated quote" );
  408.                     yyterminate();
  409.                     }
  410.               <<EOF>>          {
  411.                     yyin = fopen( next_file, "r" );
  412.                     YY_NEW_FILE;
  413.                     }
  414.  
  415.  
  416.      -    flex dynamically resizes its internal tables, so direc-
  417.           tives like "%a 3000" are not needed when specifying
  418.           large scanners.
  419.  
  420.      -    The scanning routine generated by flex is declared
  421.           using the macro YY_DECL. By redefining this macro you
  422.           can change the routine's name and its calling sequence.
  423.           For example, you could use:
  424.  
  425.               #undef YY_DECL
  426.               #define YY_DECL float lexscan( a, b ) float a, b;
  427.  
  428.           to give it the name _l_e_x_s_c_a_n, returning a float, and
  429.           taking two floats as arguments.  Note that if you give
  430.           arguments to the scanning routine, you must terminate
  431.           the definition with a semi-colon (;).
  432.  
  433.      -    flex generates #line directives mapping lines in the
  434.           output to their origin in the input file.
  435.  
  436.      -    You can put multiple actions on the same line,
  437.           separated with semi-colons.  With lex, the following
  438.  
  439.               foo    handle_foo(); return 1;
  440.  
  441.           is truncated to
  442.  
  443.               foo    handle_foo();
  444.  
  445.           flex does not truncate the action.  Actions that are
  446.           not enclosed in braces are terminated at the end of the
  447.           line.
  448.  
  449.      -    Actions can be begun with %{ and terminated with %}. In
  450.           this case, flex does not count braces to figure out
  451.           where the action ends - actions are terminated by the
  452.           closing %}. This feature is useful when the enclosed
  453.           action has extraneous braces in it (usually in comments
  454.           or inside inactive #ifdef's) that throw off the brace-
  455.           count.
  456.  
  457.  
  458.  
  459. Printed 2/10/90           20 June 1989                          7
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. FLEX(1)             UNIX Programmer's Manual              FLEX(1)
  467.  
  468.  
  469.  
  470.      -    All of the scanner actions (e.g., ECHO, yywrap ...)
  471.           except the unput() and input() routines, are written as
  472.           macros, so they can be redefined if necessary without
  473.           requiring a separate library to link to.
  474.  
  475.      -    When yywrap() indicates that the scanner is done pro-
  476.           cessing (it does this by returning non-zero), on subse-
  477.           quent calls the scanner will always immediately return
  478.           a value of 0.  To restart it on a new input file, the
  479.           action yyrestart() is used.  It takes one argument, the
  480.           new input file.  It closes the previous yyin (unless
  481.           stdin) and sets up the scanners internal variables so
  482.           that the next call to yylex() will start scanning the
  483.           new file.  This functionality is useful for, e.g., pro-
  484.           grams which will process a file, do some work, and then
  485.           get a message to parse another file.
  486.  
  487.      -    Flex scans the code in section 1 (inside %{}'s) and the
  488.           actions for occurrences of _R_E_J_E_C_T and _y_y_m_o_r_e(). If it
  489.           doesn't see any, it assumes the features are not used
  490.           and generates higher-performance scanners.  Flex tries
  491.           to be correct in identifying uses but can be fooled
  492.           (for example, if a reference is made in a macro from a
  493.           #include file).  If this happens (a feature is used and
  494.           flex didn't realize it) you will get a compile-time
  495.           error of the form
  496.  
  497.               reject_used_but_not_detected undefined
  498.  
  499.           You can tell flex that a feature is used even if it
  500.           doesn't think so with %used followed by the name of the
  501.           feature (for example, "%used REJECT"); similarly, you
  502.           can specify that a feature is _n_o_t used even though it
  503.           thinks it is with %unused.
  504.  
  505.      -    Comments may be put in the first section of the input
  506.           by preceding them with '#'.
  507.  
  508. FILES
  509.      _f_l_e_x._s_k_e_l
  510.           skeleton scanner
  511.  
  512.      _l_e_x._y_y._c
  513.           generated scanner (called _l_e_x_y_y._c on some systems).
  514.  
  515.      _l_e_x._b_a_c_k_t_r_a_c_k
  516.           backtracking information for -b flag (called _l_e_x._b_c_k on
  517.           some systems).
  518.  
  519. SEE ALSO
  520.      lex(1)
  521.  
  522.  
  523.  
  524.  
  525. Printed 2/10/90           20 June 1989                          8
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. FLEX(1)             UNIX Programmer's Manual              FLEX(1)
  533.  
  534.  
  535.  
  536.      M. E. Lesk and E. Schmidt, _L_E_X - _L_e_x_i_c_a_l _A_n_a_l_y_z_e_r _G_e_n_e_r_a_t_o_r
  537.  
  538. AUTHOR
  539.      Vern Paxson, with the help of many ideas and much inspira-
  540.      tion from Van Jacobson.  Original version by Jef Poskanzer.
  541.      Fast table representation is a partial implementation of a
  542.      design done by Van Jacobson.  The implementation was done by
  543.      Kevin Gong and Vern Paxson.
  544.  
  545.      Thanks to the many flex beta-testers and feedbackers, espe-
  546.      cially Casey Leedom, Frederic Brehm, Nick Christopher, Chris
  547.      Faylor, Eric Goldman, Eric Hughes, Greg Lee, Craig Leres,
  548.      Mohamed el Lozy, Jim Meyering, Esmond Pitt, Jef Poskanzer,
  549.      and Dave Tallman.  Thanks to Keith Bostic, John Gilmore, Bob
  550.      Mulcahy, Rich Salz, and Richard Stallman for help with vari-
  551.      ous distribution headaches.
  552.  
  553.      Send comments to:
  554.  
  555.           Vern Paxson
  556.           Real Time Systems
  557.           Bldg. 46A
  558.           Lawrence Berkeley Laboratory
  559.           1 Cyclotron Rd.
  560.           Berkeley, CA 94720
  561.  
  562.           (415) 486-6411
  563.  
  564.           vern@csam.lbl.gov
  565.           vern@rtsg.ee.lbl.gov
  566.           ucbvax!csam.lbl.gov!vern
  567.  
  568.      I will be gone from mid-July '89 through mid-August '89.
  569.      From August on, the addresses are:
  570.  
  571.           vern@cs.cornell.edu
  572.  
  573.           Vern Paxson
  574.           CS Department
  575.           Grad Office
  576.           4126 Upson
  577.           Cornell University
  578.           Ithaca, NY 14853-7501
  579.  
  580.           <no phone number yet>
  581.  
  582.      Email sent to the former addresses should continue to be
  583.      forwarded for quite a while.  Also, it looks like my user-
  584.      name will be "paxson" and not "vern".  I'm planning on hav-
  585.      ing a mail alias set up so "vern" will still work, but if
  586.      you encounter problems try "paxson".
  587.  
  588.  
  589.  
  590.  
  591. Printed 2/10/90           20 June 1989                          9
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. FLEX(1)             UNIX Programmer's Manual              FLEX(1)
  599.  
  600.  
  601.  
  602. DIAGNOSTICS
  603.      _f_l_e_x _s_c_a_n_n_e_r _j_a_m_m_e_d - a scanner compiled with -s has encoun-
  604.      tered an input string which wasn't matched by any of its
  605.      rules.
  606.  
  607.      _f_l_e_x _i_n_p_u_t _b_u_f_f_e_r _o_v_e_r_f_l_o_w_e_d - a scanner rule matched a
  608.      string long enough to overflow the scanner's internal input
  609.      buffer (16K bytes - controlled by YY_BUF_MAX in
  610.      "flex.skel").
  611.  
  612.      _o_l_d-_s_t_y_l_e _l_e_x _c_o_m_m_a_n_d _i_g_n_o_r_e_d - the flex input contains a
  613.      lex command (e.g., "%n 1000") which is being ignored.
  614.  
  615. BUGS
  616.      Some trailing context patterns cannot be properly matched
  617.      and generate warning messages ("Dangerous trailing con-
  618.      text").  These are patterns where the ending of the first
  619.      part of the rule matches the beginning of the second part,
  620.      such as "zx*/xy*", where the 'x*' matches the 'x' at the
  621.      beginning of the trailing context.  (Lex doesn't get these
  622.      patterns right either.) If desperate, you can use yyless()
  623.      to effect arbitrary trailing context.
  624.  
  625.      _v_a_r_i_a_b_l_e trailing context (where both the leading and trail-
  626.      ing parts do not have a fixed length) entails the same per-
  627.      formance loss as _R_E_J_E_C_T (i.e., substantial).
  628.  
  629.      For some trailing context rules, parts which are actually
  630.      fixed-length are not recognized as such, leading to the
  631.      abovementioned performance loss.  In particular, parts using
  632.      '|' or {n} are always considered variable-length.
  633.  
  634.      Use of unput() or input() trashes the current yytext and
  635.      yyleng.
  636.  
  637.      Use of unput() to push back more text than was matched can
  638.      result in the pushed-back text matching a beginning-of-line
  639.      ('^') rule even though it didn't come at the beginning of
  640.      the line.
  641.  
  642.      yytext and yyleng cannot be modified within a flex action.
  643.  
  644.      Nulls are not allowed in flex inputs or in the inputs to
  645.      scanners generated by flex.  Their presence generates fatal
  646.      errors.
  647.  
  648.      Flex does not generate correct #line directives for code
  649.      internal to the scanner; thus, bugs in _f_l_e_x._s_k_e_l yield bogus
  650.      line numbers.
  651.  
  652.      Pushing back definitions enclosed in ()'s can result in
  653.      nasty, difficult-to-understand problems like:
  654.  
  655.  
  656.  
  657. Printed 2/10/90           20 June 1989                         10
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664. FLEX(1)             UNIX Programmer's Manual              FLEX(1)
  665.  
  666.  
  667.  
  668.           {DIG}  [0-9] /* a digit */
  669.  
  670.      In which the pushed-back text is "([0-9] /* a digit */)".
  671.  
  672.      Due to both buffering of input and read-ahead, you cannot
  673.      intermix calls to stdio routines, such as, for example,
  674.      getchar() with flex rules and expect it to work.  Call
  675.      input() instead.
  676.  
  677.      The total table entries listed by the -v flag excludes the
  678.      number of table entries needed to determine what rule has
  679.      been matched.  The number of entries is equal to the number
  680.      of DFA states if the scanner does not use REJECT, and some-
  681.      what greater than the number of states if it does.
  682.  
  683.      To be consistent with ANSI C, the escape sequence \xhh
  684.      should be recognized for hexadecimal escape sequences, such
  685.      as '\x41' for 'A'.
  686.  
  687.      It would be useful if flex wrote to lex.yy.c a summary of
  688.      the flags used in its generation (such as which table
  689.      compression options).
  690.  
  691.      The scanner run-time speeds still have not been optimized as
  692.      much as they deserve.  Van Jacobson's work shows that the
  693.      can go faster still.
  694.  
  695.      The utility needs more complete documentation.
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723. Printed 2/10/90           20 June 1989                         11
  724.  
  725.  
  726.  
  727.